package com.hdcx.Minfresh.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

/**
 * Created by Administrator on 2016/12/1.
 */

public class CountLineView extends View {
    Paint mPaint;
    Point start;
    Point end;

    public CountLineView(Context context) {
        super(context);
        init();
    }

    public CountLineView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public CountLineView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }


    private void init() {
        mPaint = new Paint();
        mPaint.setStrokeWidth(5.0f);
        mPaint.setColor(0xff888888);
        mPaint.setAntiAlias(true);
        start = new Point(100,getHeight()/2);
        end = new Point(getWidth()-100,getHeight()/2);
    }

    @Override
    protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),200);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawLine(100,getHeight()/2,getWidth()-100,getHeight()/2,mPaint);
        canvas.drawCircle(100,getHeight()/2,10,mPaint);
        canvas.drawCircle(getWidth()-100,getHeight()/2,10,mPaint);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        switch (event.getAction()){
            //case
        }




        return super.onTouchEvent(event);

    }
}
